package org.springboot.sample.service.impl;

import java.util.List;

import org.springboot.sample.dao.UserDao;
import org.springboot.sample.po.User;
import org.springboot.sample.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService{

	@Autowired
	private UserDao userdao;
	
	@Override
	public Boolean isExistUsers(User user) {
		Boolean existence = userdao.isExistence(user);
		return existence;
	}

	@Override
	public void addUsers(User user) {
		userdao.addUser(user);
	}

	@Override
	public void deleteUsers(int id) {
		userdao.deleteUsersById(id);
	}

	@Override
	public void updateUsers(int userId, String updateUsername) {
		userdao.updateUserName(userId, updateUsername);
		
	}

	@Override
	public List<User> findUserList() {
		return userdao.findAll();
	}

	@Override
	public int getUsersIdByNameAndPassword(User user) {
		return userdao.findIdByNameAndPassword(user);
	}
}
